package com.example.design.strategyDemo;

import com.example.design.utils.SpringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/strategy")
public class TestStrategy {

    @RequestMapping("/test")
    public String test(String doCode) {
        String beanName = DesignEnum.getBeanName(doCode);
        DemoStrategy demoStrategy = (DemoStrategy) SpringUtils.getBean(beanName);
        demoStrategy.doSomething();
        return "执行成功";
    }
}
